package com.atom.plugin;

import com.atom.plugin.core.AbstractExtension;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class AapExtension extends AbstractExtension {

    public final List<AapScanner> registerList = new ArrayList<>();

    public String[] filterJar;

    public AapExtension() {
        registerList.add(
                new AapSuperScanner("com/atom/annotation/bean/ApiImpls")
        );
    }

    private boolean isInit = false;

    public String[] getFilterJar() {
        if (filterJar == null) {
            filterJar = presetFilterJar().toArray(new String[0]);
            isInit = true;
        } else if (!isInit) {
            final List<String> strings = presetFilterJar();
            strings.addAll(Arrays.asList(filterJar));
            filterJar = strings.toArray(new String[0]);
            isInit = true;
        }
        return filterJar;
    }

    private List<String> presetFilterJar() {
        final List<String> result = new ArrayList<>();
        result.add("constraintlayout") ;
        result.add("module-reporter") ;
        result.add("appcompat") ;
        result.add("cursoradapter") ;
        result.add("fragment") ;
        result.add("appcompat-resources") ;
        result.add("drawerlayout") ;
        result.add("vectordrawable-animated") ;
        result.add("vectordrawable") ;
        result.add("recyclerview") ;
        result.add("viewpager") ;
        result.add("versionedparcelable") ;
        result.add("customview") ;
        result.add("activity") ;
        result.add("lifecycle-runtime") ;
        result.add("lifecycle-viewmodel") ;
        result.add("savedstate") ;
        result.add("interpolator") ;
        result.add("lifecycle-livedata-core") ;
        result.add("core-runtime") ;
        result.add("lifecycle-livedata") ;
        result.add("lifecycle-common") ;
        result.add("constraintlayout-solver") ;
        result.add("module-logger") ;
        result.add("kotlin-stdlib") ;
        result.add("stdlib-common") ;
        result.add("atom-annotation") ;
        return result;
    }
}
